<template>
  <el-link v-for="link in links" :underline="false" :href="link.href" :key="link.name" target="_blank" class="link">
    <div class="web-page-module-link-card">
      <img class="web-page-module-link-team-card-icon" v-lazy="link.logoUrl" :alt="link.name" />
      <div class="web-page-module-link-card-title">{{ link.name }}</div>
      <div class="web-page-module-link-card-desc">{{ link.desc }}</div>
    </div>
  </el-link>
</template>

<script lang="ts" setup>
import { defineProps, PropType } from 'vue'
type Link = {
  name: string;
  href: string;
  logoUrl: string;
  desc: string;
};
defineProps({
  links: {
    type: Array as unknown as PropType<[Link]>,
    default: () => []
  }
})

</script>
<style lang="scss" scoped>
.web-page-module-link-card {
  position: relative;
  padding: 10px;
  float: left;
  margin-right: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  background-color: #f5f7fd;

  .web-page-module-link-team-card-icon {
    position: relative;
    float: left;
    width: 20px;
    height: 20px;
  }

  .web-page-module-link-card-title {
    text-align: left;
    width: 170px;
    font-weight: 400;
    text-indent: 5px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
  }

  .web-page-module-link-card-desc {
    font-size: 11px;
    color: #7c7a7a;
    text-indent: 0px;
    margin-top: 10px;
    text-align: left;
    width: 180px;
    font-weight: 400;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
  }
}

.web-page-module-link-card:hover {
  cursor: pointer;
  background-color: #dce3f8;
}

@media screen and (max-width: 480px) {
  .link {
    width: 33%;
    overflow: hidden;

    ::v-deep .el-link__inner {
      width: 100%;
    }

    .web-page-module-link-card {
      width: 100%;

      .web-page-module-link-card-title {
        position: absolute;
        left: 30px;
        width: calc(100% - 50px);
      }

      .web-page-module-link-card-desc {
        margin-top: 25px;
        width: 100%;
      }
    }
  }
}
</style>
